import React from 'react';
import { ValidatorProvider } from './ValidatorContext';
import ValidatorEditor from './ValidatorEditor';

function ValidatorVersion({ match, location }) {
  const {
    params: { validationId },
  } = match;
  const {
    query: { versionId, readOnly = 'false' },
  } = location;

  return (
    <ValidatorProvider value={{ validationId, versionId, readOnly: readOnly === 'true' }}>
      <ValidatorEditor />
    </ValidatorProvider>
  );
}

export default ValidatorVersion;
